<?php
class Application_Plugin_Init extends Zend_Controller_Plugin_Abstract
{
	public function __construct(){
		$this->initIdentity();
	}

	private function initIdentity(){
		if(Zend_Auth::getInstance()->hasIdentity()) {
			$userInfo = Zend_Auth::getInstance()->getIdentity();
			Zend_Registry::set('userInfo', $userInfo);
		}
	}

	public function preDispatch(Zend_Controller_Request_Abstract $request) {
		$layout = Zend_Layout::getMvcInstance();
		if ( $request->getControllerName() == "admin" ){
			$layout->setLayout("admin");
		}
	}
}
